package com.yiren.backstage.currency.entity;
import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.ToOne;
import com.yiren.backstage.db.dao.DaoSession;
import com.yiren.backstage.db.dao.JudgeEntityDao;
import com.yiren.backstage.db.dao.ProjectEntityDao;
import com.yiren.backstage.db.dao.ProjectJudgeEntityDao;

/**
 * Time:2021/11/01 10:11
 * Author:xiaozan
 * Description:项目评判实体类
 */
@Entity(nameInDb = "project_judge", createInDb = false)
public class ProjectJudgeEntity {
    @Id
    private String id;

    //所属父级项目评判 控制执行顺序
    private String parentId;
    @ToOne(joinProperty = "parentId")
    private ProjectJudgeEntity parentProjectJudgeEntity;

    //所属项目
    private String projectId;
    @ToOne(joinProperty = "projectId")
    private ProjectEntity project;

    //评判
    private String judgeId;
    @ToOne(joinProperty = "judgeId")
    private JudgeEntity judgeEntity;

    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;

    /** Used for active entity operations. */
    @Generated(hash = 983111676)
    private transient ProjectJudgeEntityDao myDao;
    @Generated(hash = 804898097)
    public ProjectJudgeEntity(String id, String parentId, String projectId,
            String judgeId) {
        this.id = id;
        this.parentId = parentId;
        this.projectId = projectId;
        this.judgeId = judgeId;
    }
    @Generated(hash = 1902985072)
    public ProjectJudgeEntity() {
    }
    public String getId() {
        return this.id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getParentId() {
        return this.parentId;
    }
    public void setParentId(String parentId) {
        this.parentId = parentId;
    }
    public String getProjectId() {
        return this.projectId;
    }
    public void setProjectId(String projectId) {
        this.projectId = projectId;
    }
    public String getJudgeId() {
        return this.judgeId;
    }
    public void setJudgeId(String judgeId) {
        this.judgeId = judgeId;
    }
    @Generated(hash = 454933155)
    private transient String parentProjectJudgeEntity__resolvedKey;
    /** To-one relationship, resolved on first access. */
    @Generated(hash = 2126173171)
    public ProjectJudgeEntity getParentProjectJudgeEntity() {
        String __key = this.parentId;
        if (parentProjectJudgeEntity__resolvedKey == null
                || parentProjectJudgeEntity__resolvedKey != __key) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            ProjectJudgeEntityDao targetDao = daoSession.getProjectJudgeEntityDao();
            ProjectJudgeEntity parentProjectJudgeEntityNew = targetDao.load(__key);
            synchronized (this) {
                parentProjectJudgeEntity = parentProjectJudgeEntityNew;
                parentProjectJudgeEntity__resolvedKey = __key;
            }
        }
        return parentProjectJudgeEntity;
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1257347068)
    public void setParentProjectJudgeEntity(
            ProjectJudgeEntity parentProjectJudgeEntity) {
        synchronized (this) {
            this.parentProjectJudgeEntity = parentProjectJudgeEntity;
            parentId = parentProjectJudgeEntity == null ? null
                    : parentProjectJudgeEntity.getId();
            parentProjectJudgeEntity__resolvedKey = parentId;
        }
    }
    @Generated(hash = 394401268)
    private transient String project__resolvedKey;
    /** To-one relationship, resolved on first access. */
    @Generated(hash = 1826027793)
    public ProjectEntity getProject() {
        String __key = this.projectId;
        if (project__resolvedKey == null || project__resolvedKey != __key) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            ProjectEntityDao targetDao = daoSession.getProjectEntityDao();
            ProjectEntity projectNew = targetDao.load(__key);
            synchronized (this) {
                project = projectNew;
                project__resolvedKey = __key;
            }
        }
        return project;
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 439791433)
    public void setProject(ProjectEntity project) {
        synchronized (this) {
            this.project = project;
            projectId = project == null ? null : project.getId();
            project__resolvedKey = projectId;
        }
    }
    @Generated(hash = 1029132789)
    private transient String judgeEntity__resolvedKey;
    /** To-one relationship, resolved on first access. */
    @Generated(hash = 2042024408)
    public JudgeEntity getJudgeEntity() {
        String __key = this.judgeId;
        if (judgeEntity__resolvedKey == null || judgeEntity__resolvedKey != __key) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            JudgeEntityDao targetDao = daoSession.getJudgeEntityDao();
            JudgeEntity judgeEntityNew = targetDao.load(__key);
            synchronized (this) {
                judgeEntity = judgeEntityNew;
                judgeEntity__resolvedKey = __key;
            }
        }
        return judgeEntity;
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1834375858)
    public void setJudgeEntity(JudgeEntity judgeEntity) {
        synchronized (this) {
            this.judgeEntity = judgeEntity;
            judgeId = judgeEntity == null ? null : judgeEntity.getId();
            judgeEntity__resolvedKey = judgeId;
        }
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 517762700)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getProjectJudgeEntityDao() : null;
    }

}
